package com.tm.servicemsm.demos;

import java.util.List;
/**
 * 2024/7/19 Cjj
 * 订单,以及根据当前位置查找附近售卖机等功能
 */
public class Pump {
    private Object latitude;
    private Object longitude;
    private Double userLatitude;

    public Pump(int i, String s, double v, double v1) {
    }

    public static Pump findClosestPump(List<Pump> pumps, double userLongitude, double longitude) {
        if (pumps.isEmpty()) {
            return null;
        }

        Pump closest = pumps.get(0);

        distance(closest.latitude, closest.longitude, closest.userLatitude);

        for (Pump pump : pumps) {
            distance(pump.latitude, pump.longitude, userLongitude);

            closest = pump;

        }
        return closest;
    }

    private static double distance(Object latitude, Object longitude, Double userLatitude) {
        double minDistance = distance(latitude, longitude, userLatitude);

        return minDistance;
    }
}
